#pragma once

#include <list>

#include "collector.h"


template <typename T>
class ListCollectorAdapter : public Collector<T>
{
public:
    ListCollectorAdapter(std::list<T> &list)
        : list_(list) {}

    virtual ~ListCollectorAdapter() {}

    virtual void add(const T &e) override {
        list_.push_back(e);
    }

    virtual void add(T &&e) override {
        list_.push_back(std::move(e));
    }

private:
    std::list<T> &list_;
};
